﻿<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="4.0" encoding="iso-8859-1" indent="yes"/>

<xsl:template match="/">

	<xsl:variable name="level1Current" select="/menu/level1[@class = 'current']"/>
	<xsl:if test="$level1Current">
		<span><a href="http://vplink/pages/default.aspx" onclick="javascript:_paq.push(['trackPageView', 'Accueil']);">Accueil</a></span>
	</xsl:if>
	<xsl:if test="not($level1Current)">
		&#160;
	</xsl:if>
	<xsl:for-each select="$level1Current">
		<xsl:variable name="nameN1" select="@namepiwik"/>
		&#160;>&#160;
		<xsl:if test="@link">
			<span>
				<a href="{@link}" onclick="javascript:_paq.push(['trackPageView', '{$nameN1}']);" class="filAriane"><xsl:value-of select="@name"/></a>
			</span>
		</xsl:if>
		<xsl:if test="not(@link)">
			<span class="filAriane"><xsl:value-of select="@name"/></span>
		</xsl:if>
		<xsl:choose>
			<xsl:when test="level2[not(@suppression='true') and @class='currentlevel2'] 
				and not(level2[not(@suppression='true') and @class='currentlevel2']/level3[not(@suppression='true')])">
				&#160;>
				<xsl:for-each select="level2[not(@suppression='true') and @class='currentlevel2']">
					<xsl:variable name="nameN2" select="@namepiwik"/>
					&#160;
					<xsl:if test="@link">
						<span>
							<a href="{@link}" onclick="javascript:_paq.push(['trackPageView', '{$nameN1}/{$nameN2}']);" class="filAriane"><xsl:value-of select="@name"/></a>
						</span>
					</xsl:if>
					<xsl:if test="not(@link)">
						<span class="filAriane"><xsl:value-of select="@name"/></span>
					</xsl:if>
				</xsl:for-each>
			</xsl:when>
			<xsl:otherwise>
				&#160;>
				<xsl:for-each select="level2[not(@suppression='true') and @class='currentlevel2']">
					<xsl:variable name="nameN2" select="@namepiwik"/>
					&#160;
					<xsl:if test="@link">
						<span>
							<a href="{@link}" onclick="javascript:_paq.push(['trackPageView', '{$nameN1}/{$nameN2}']);" class="filAriane"><xsl:value-of select="@name"/></a>
						</span>
					</xsl:if>
					<xsl:if test="not(@link)">
						<span class="filAriane"><xsl:value-of select="@name"/></span>
					</xsl:if>
					&#160;>
					<xsl:for-each select="level3[not(@suppression='true') and @class='currentlevel3']">
						&#160;
						<span class="filAriane"><xsl:value-of select="@name"/></span>&#160;&#160;
					</xsl:for-each>
				</xsl:for-each>
			
			</xsl:otherwise>
		</xsl:choose>      
	</xsl:for-each>

</xsl:template>

</xsl:stylesheet>